package common.model{
	import ui.maps.PointModel;

[Bindable]
[RemoteClass(alias="org.sunleads.common.entity.WqMapRegion")]
public class WqMapRegion{
	
	public static const TYPE_LINE:String = "0";//线形
	public static const TYPE_RECTANGLE:String = "1";//矩形
	public static const TYPE_POLYGON:String = "2";//多边形
	public static const TYPE_CIRCLE:String = "3";//圆形

	public var id:String;
	public var name:String;
	public var standby1:String;
	public var points:String;
	public var standby2:String;
	public var radius:Number;
	public var zoom:Number;
	public var type:String;
	public var standby3:String;
	public var companyId:String;
	public var creater:String;
	public var createTime:Date;
	
	//用来在区域里显示的文字内容
	public var content:String;
	
	public var checked:String;
	
	public function WqMapRegion(id:String=null,name:String=null,type:String=null,zoom:Number=15,points:String=null){
		this.id = id;
		this.name = name;
		this.type = type;
		this.zoom = zoom;
		this.points = points;
	}
	
	public function getPoints():Array{
		if(!points){
			return null;
		}
		var returnPoints:Array = [];
		var ps:Array = points.split(";");
		for(var i:int=0; i<ps.length; i++){
			var p:Array = String(ps[i]).split(",");
			if(p.length==2){
				returnPoints.push(new PointModel(p[0],p[1],id+"_"+i));
			}
		}
		return returnPoints;
	}
	
	public function setPoints(pointArr:Array):void{
		var result:String = "";
		if(pointArr){
			for each(var pointModel:PointModel in pointArr){
				result = result + pointModel.lng + "," + pointModel.lat + ";";
			}
		}
		points = result;
	}
}
}